import json
import os
import sys
import random
import logging
from iphack import ip


import requests
import serial
ser = serial.Serial('/dev/ttyUSB0')  # open serial port
print(ser.name)         # check which port was really used
ser.write(b'hello')     # write a string
ser.close()             # close port

response = requests.get('https://httpbin.org/ip')

print('Your IP is {0}'.format(response.json()['origin']))

# import portscanner
# my_target = portscanner.Target("baidu.com")

from class01 import Class01
a = 100
# print('a is {a}')
x = [1, 'simple', 'list']
print(json.dumps(a))
print(json.dumps(x))
c = Class01()
# print(c)
# c.sayHi()
print(os.getcwd())
print(os.getlogin())
print(os.cpu_count())
print(os.curdir)
print(sys.argv)
print(random.random())
print(random.choice([1, 3, 2,4,5,7,8,9]))
print(random.randint(1,100))
print(random.randint(1,100))


f = open("myfile.txt", "r", encoding="utf-8")

str = f.readline()
print(str)
str = f.readline()
print(str)
str = f.readline()
print(str)



logging.debug('Debugging information')
# logging.info('Informational message')
# logging.warning('Warning:config file %s not found', 'server.conf')
# logging.error('Error occurred')
# logging.critical('Critical error -- shutting down')


# ip address tracking

# ip.address("8.8.8.8")
ip.my()
